-- study_hard
-- created by panyl
-- 是否努力学习问题

return {
    fetch = function(id)
        return true;
    end,

    calc_bonus = function(id)
        local args = PinocchioM.query_quetion(id, "bonus_args") or {};

        return { 1, args["item"], args["count"] or 1, };
    end,

    check_answer = function(id, index)
        local cond = PinocchioM.query_quetion(id, "condition");

        if type(cond) ~= "number" or cond <= 0 then
            return 1;
        end

        local pet = ME.user:getActivePet();
        if not pet then
            return 0;
        end

        local data = pet:getCareerData() or {};
        local num = 0;

        for _, info in pairs(data) do
            num = num + sizeof(info);
        end

        local res = iif(num >= cond, 1, 2);

        return iif(index == res, 1, 0);
    end,
};
